function [channel_out,Outm,Outn,Ch1,seed_out] = L11_PassChannel(data_ifft,snr_dB,subframe_index,channel_gen,jump,seed,user_index)
% function [channel_out,Outm,Outn,Ch1,seed_out] =
% L11_PassChannel(data_ifft,snr_dB,subframe_index,channel_gen,jump,seed,user_index)
% Pass channel;
% Input
% data_ifft - data after OFDM modulation
% snr_dB - SNR in dB
% subframe_index - subframe index 
% channel_gen - channel generation indicator
% jump - jump indicator
% seed - reserved for periodical channel seed renew
% user_index - User index
% Output
% channel_output - received signal
% Ch1 - CSI in frequency domain 
% seed_out - Reserved for channel seed storage
    global sim_consts;
    v = sim_consts.v;
    fc = sim_consts.fc;
    samplingrate = sim_consts.samplingrate;
    delay =sim_consts.delay;
    power = sim_consts.power;
    Mt = sim_consts.Mt;
    Mr = sim_consts.Mr;
    num_OFDM_slot = sim_consts.num_OFDM_slot;
    ifft_length = sim_consts.ifft_length;
    Gp_length_short = sim_consts.Gp_length_short;
    Gp_length_long = sim_consts.Gp_length_long;
    cor = sim_consts.cor;
   
    % 
    if mod(subframe_index,7) == 0 && channel_gen == 0
        seed = fix(now*10e15);
        seed = seed - floor(seed/10e8)*10e8;
    end;
    
    seed_out = seed;

    [r1,Ch1]=corre_mimochannel(v,fc,samplingrate,size(data_ifft,2),delay,power,data_ifft,Mt,Mr,num_OFDM_slot,ifft_length*num_OFDM_slot,ifft_length,Gp_length_short,Gp_length_long,subframe_index,cor,seed,channel_gen,jump,user_index);
    if jump == 1
        channel_out = [];
        Outm = [];
        Outn = [];
        return;
    end;
    r1_awgn = awgn(r1,snr_dB,10*log10(sc_num/2048));
    channel_out = r1_awgn;
    
%     if MIMO_mode == 2
%         r1_awgn = awgn(r1,snr_dB,10*log10(sc_num/2048/2));
%     else
%         r1_awgn = awgn(r1,snr_dB,10*log10(sc_num/2048));
%     end;


